$NG.AllReady(function (page, { useAction, useBeforeClick, useValuesChange, useClick, useUpdateRow, subscribe, useUpdateRows }) {
    const mstform = $NG.getCmpApi("CntPayMForm")
    const dgrid1 = $NG.getCmpApi("")
    const getHeadValue = (str) => mstform.getItem(str).getValue()
    console.log(`page`, page, page.isList);
    const list = $NG.getCmpApi("CntPayM")
    const url = `${location.href}`
    setTimeout(() => {
        const param = parseUrlParams(url)
        const keys = Object.keys(param)
        console.log(`keys`, keys);
        if (!param.AppTitle.includes("-")) {
            if (keys.includes('cnt_id')) {
                if (param.cnt_id == 'add') {
                    param.cnt_id = 0
                }
                console.log(`列表页面`,);
                list.getItem("PhidCnt*int64*eq*1").setValue({
                    label: param.cnt_name,
                    value: param.cnt_id
                })
                setTimeout(() => {
                    list.submit()
                }, 200)
            }
        }
    }, 200)

    // 解析URL  
    function parseUrlParams(url) {
        const result = {};

        if (!url) return result;

        // 先拆出 ? 和 #
        const [beforeHash, hashPart] = url.split('#');

        // 处理 ? 部分
        if (beforeHash.includes('?')) {
            const queryStr = beforeHash.split('?')[1];
            queryStr.split('&').forEach(pair => {
                const [key, value] = pair.split('=');
                result[key] = decodeURIComponent(value || '');
            });
        }

        // 处理 # 后面的参数
        if (hashPart && hashPart.includes('?')) {
            const hashQueryStr = hashPart.split('?')[1];
            hashQueryStr.split('&').forEach(pair => {
                const [key, value] = pair.split('=');
                result[key] = decodeURIComponent(value || '');
            });
        }

        return result;
    }
}, function () {

})